﻿using DeepEarth.Map.Core;
using System.Collections.Generic;
using Microsoft.Maps.MapControl;
using System;
using DeepEarth.Map.Core.Tiling;
namespace DeepEarth.Map.BingMaps
{
    public class BingMapModeFactory : BaseTileSourceFactory
    {
        public const string Mode_Road = "Road";
        public const string Mode_Aerial = "Aerial";
        public const string Mode_AerialWithLabels = "AerialWithLabels";
        public const string Mode_AerialWithFadingLabels = "AerialWithFloatingLabels";

        public static MapMode Road = new MapMode("bing", "bing", "Road", "Road", 1, false, true, false);
        public static MapMode Aerial = new MapMode("bing", "bing", "Aerial", "Aerial", 1, false, false, false);
        public static MapMode AerialWithLabels = new MapMode("bing", "bing", "AerialWithLabels", "AerialWithLabels", 1, false, true, false);
        public static MapMode AerialWithFadingLabels = new MapMode("bing", "bing", "AerialWithFadingLabels", "AerialWithFadingLabels", 1, false, true, false);

        private List<MapMode> availableModes = new List<MapMode>() { Road, Aerial, AerialWithLabels, AerialWithFadingLabels };

        public override System.Collections.Generic.IList<MapMode> AvailableModes
        {
            get { return availableModes; }
        }

        public override BaseTileSource CreateTileSource(MapMode mode)
        {
            return null;
        }

        public static Microsoft.Maps.MapControl.Core.MapMode CreateBingMapMode(MapMode mode)
        {
            Microsoft.Maps.MapControl.AerialMode am = new AerialMode();
            switch (mode.Identifier)
            {
                case Mode_Road :
                    Microsoft.Maps.MapControl.RoadMode rm = new RoadMode();
                    return rm;
                case Mode_AerialWithFadingLabels :
                    am.FadingLabels = true;
                    goto case Mode_AerialWithLabels;
                case Mode_AerialWithLabels :
                    am.Labels = true;
                    goto case Mode_Aerial;
                case Mode_Aerial :
                    return am;
            }

            throw new ArgumentException("Invalid Map Mode");
        }
    }
}
